import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { resolve } from "path";
import styleImport, { VantResolve } from 'vite-plugin-style-import';
export default defineConfig({
	plugins: [
		uni(),
		styleImport({
			resolves: [VantResolve()],
		  }),
		Components({
			dirs: ["src/components"],
			extensions: ["vue"],
			dts: "src/components.d.ts",
		}),
		AutoImport({
			include: [
				/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
				/\.vue$/,
				/\.vue\?vue/, // .vue
				/\.md$/, // .md
			],
			imports: [
				"vue",
				"@vueuse/core",
				{
					"@/store/modules/user": ["useUserStore"],
				},
			],
			dts: "src/auto-import.d.ts",
		}),
	],
  resolve: {
		alias: {
			"@": resolve(__dirname, "src"), // 路径别名
		},
		extensions: [".js", ".json", ".ts"], // 使用路径别名时想要省略的后缀名，可以自己 增减
	},
	// css: {
	// 	preprocessorOptions: {
	// 	  scss: {
	// 		// 配置 nutui 全局 scss 变量
	// 		additionalData: `@import "@nutui/nutui/dist/styles/variables.scss";`
	// 	  }
	// 	}
	//   },
});
